{
LANG : PASCAL
PROB : milk3
}

program MILK3;
const
  fi = 'milk3.in';
  fo = 'milk3.out';
  max = 20;
type
  tt = record
         b : array[1..3] of byte;
       end;
var
  ac : array[0..max, 0..max] of boolean;
  q : array[1..max*max] of tt;
  s : tt;
  l, r : longint;

procedure init;
begin
  fillchar(ac, sizeof(ac), false);
  l := 1;
  r := 1;
  with q[1] do
  begin
    b[1] := 0;
    b[2] := 0;
    b[3] := s.b[3];
    ac[b[1], b[3]] := true;
  end;
end;

function max2(x, y : integer) : integer;
begin
  if x > y then max2 := x
  else max2 := y;
end;

function min2(x, y : integer) : integer;
begin
  if x < y then min2 := x
  else min2 := y;
end;

procedure pour(u : tt; x, y : integer; var v : tt);
begin
  v := u;
  v.b[x] := max2(0, u.b[x] - (s.b[y] - u.b[y]));
  v.b[y] := min2(s.b[y], u.b[y] + u.b[x]);
end;

procedure process;
var
  i, j : integer;
  u, v : tt;
begin
  while l <= r do
  begin
    u := q[l];
    inc(l);
    for i := 1 to 3 do
      for j := 1 to 3 do
        if (i <> j) and (u.b[i] > 0) and (u.b[j] < s.b[j]) then
        begin
          pour(u, i, j, v);
          with v do
            if not ac[b[1], b[3]] then
            begin
              ac[b[1], b[3]] := true;
              inc(r);
              q[r] := v;
            end;
        end;
  end;
end;

procedure out;
var
  i, top : integer;
  stack : array[1..max] of integer;
begin
  top := 0;
  for i := 0 to s.b[3] do
    if ac[0, i] then
    begin
      inc(top);
      stack[top] := i;
    end;
  for i := 1 to top-1 do write(stack[i], ' ');
  writeln(stack[top]);
end;

begin
  assign(input, fi); reset(input);
  assign(output, fo); rewrite(output);
  with s do read(b[1], b[2], b[3]);
  init;
  process;
  out;
  close(output);
  close(input);
end.